<?php
namespace Rainrock\Framework\kernel\base;

class Cookie{
	
	/**
	*	获取
	*/
	public static function get($key, $dev='')
	{
		$val = '';
		$key = QOM.$key;
		if(isset($_COOKIE[$key]))$val = $_COOKIE[$key];
		if(Rock::isempt($val))$val = $dev;
		return $val;
	}
	
	/**
	*	获取
	*/
	public static function getint($key, $dev='0')
	{
		$val = (int)self::get($key, $dev);
		return $val;
	}
	
	
	/**
	*	设置
	*/
	public static function set($key, $val)
	{
		$key 	= QOM.$key;
		$time 	= time()+360*3600*24;
		if(!$val)$time = time()-10;
		@setcookie($key, $val, $time, '/','');
	}
	
	/**
	*	移除
	*/
	public static function remove($key)
	{
		self::set($key, '');
	}
}